export interface DocumentChunk {
  id: string;
  filePath: string;
  content: string;
  startLine: number;
  endLine: number;
  embedding?: number[];
}

export interface DocumentBriefing {
  filePath: string;
  briefing: string;
  lastUpdated: Date;
  fileModified: Date; // 保持向后兼容
  fileModifiedTimestamp: number; // 新增：文件修改时间戳
}

export interface SearchResult {
  filePath: string;
  content: string;
  startLine: number;
  endLine: number;
  score: number;
}

export interface StructuredSearchResult {
  filePath: string;
  metadata: Record<string, any>;
  briefing: string;
}

export interface RefreshStats {
  totalFiles: number;
  updatedFiles: number;
  skippedFiles: number;
  chunksCreated: number;
  briefingsGenerated: number;
}

export interface RefreshTask {
  id: string;
  status: 'pending' | 'running' | 'completed' | 'failed';
  startTime: Date;
  endTime?: Date;
  directoryPath: string;
  forceUpdate: boolean;
  stats?: RefreshStats;
  error?: string;
  progress: {
    processedFiles: number;
    totalFiles: number;
    currentFile?: string;
  };
}

export interface TaskManager {
  createTask(directoryPath: string, forceUpdate: boolean): RefreshTask;
  getTask(taskId: string): RefreshTask | undefined;
  getAllTasks(): RefreshTask[];
  updateTaskProgress(taskId: string, progress: RefreshTask['progress']): void;
  completeTask(taskId: string, stats: RefreshStats): void;
  failTask(taskId: string, error: string): void;
}

export interface FrontMatterData {
  [key: string]: any;
}

export interface DocumentInfo {
  filePath: string;
  content: string;
  frontMatter: FrontMatterData;
  lastModified: Date;
}
